package com.ksm.server.context;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;

/**
 * An application context Java configuration class. The usage of Java
 * configuration requires Spring Framework 3.0 or higher with following
 * exceptions:
 * 
 * @author Slimaine BENSADOUN
 */
@Configuration
@ComponentScan(basePackages = { "com.ksm.server" })
@PropertySource({ "classpath:web.properties" })
public class WebConfiguration {

	@Resource
	private Environment environment;

	public String test;

	@Value("${file.directory}")
	public void setTest(String test) {
		this.test = test;
	}

	public String getTest() {
		return test;
	}

	/**
	 * Pour le @Value fonctionne
	 * 
	 * @return
	 */
	@Bean
	public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
		return new PropertySourcesPlaceholderConfigurer();
	}
}
